
const nodemailer = require('nodemailer')

async function sendMail (subject, text) {
  const transporter = nodemailer.createTransport({
    host: 'smtp.163.com',
    port: 465,
    secure: true, // true for 465, false for other ports
    auth: {
      user: 'ruangnazi@163.com', // generated ethereal user
      pass: '001ider' // generated ethereal password
    }
  })

  // send mail with defined transport object
  const info = await transporter.sendMail({
    from: '"apify Logger 👻" <ruangnazi@163.com>', // sender address
    to: '1038812055@qq.com', // list of receivers
    subject: subject, // Subject line
    text: text // plain text body
    //   html: "<b>Hello world?</b>" // html body
  })
}

module.exports = {
  sendMail
}
